$(function() {
	new Vue({
		el: "#shopListApp",
		data: {
			searchShop:"",
			fullscreenLoading:false,
			currentPage:1,
			totalSize:1,
			tableData: []
		},
		created:function(){
			parent.vueData.$data.hreHtml = "../shop/index.html";
			parent.vueData.activeIndex = "3";
			parent.vueData.getLeftNav("3")
			parent.vueData.$data.categoryIndex = 0
			this.getApplyShopList(1)
		},
		methods:{
            getApplyShopList(page){
			    this.fullscreenLoading = true;
			    let param = {
			    	page: page,
			    }
			    axios({
			    	url: POSTURL.getShops,
			    	method: 'post',
			    	data: param
			    }).then(response => {
			    	this.fullscreenLoading = false;
			    	if (response.data.code === 100) {
			    		if (page === 1) {
			    			if (response.data.result.pageCount <=1) {
			    				this.totalSize = response.data.result.shops.length
			    			} else {
			    				this.totalSize = response.data.result.pageCount * 10
			    			}
			    			this.tableData.length = 0;
			    			this.tableData = [];
			    		}
			    		this.tableData = this.tableData.concat(response.data.result.shops)
			    	} else {
			    		this.$message.error(response.data.message);
			    	}
			    }).catch(error => {
			    	this.fullscreenLoading = false;
			    	console.log(error);
			    	this.$message.error('服务器出错!');
			    })
			} ,
			addShop(){
				parent.vueData.handleOpen(32,0);
			},
			deletShop(val){
				
				this.fullscreenLoading = true;
				let param = {
					data: val.uid,
				}
				axios({
					url: POSTURL.deleteShop,
					method: 'post',
					data: param
				}).then(response => {
					this.fullscreenLoading = false;
					if (response.data.code === 100) {
						this.getApplyShopList(1)
					} else {
						this.$message.error(response.data.message);
					}
				}).catch(error => {
					this.fullscreenLoading = false;
					console.log(error);
					this.$message.error('服务器出错!');
				})
			},
			resumeShop(val){
				this.fullscreenLoading = true;
				let param = {
					data: val.uid,
				}
				axios({
					url: POSTURL.relieveShop,
					method: 'post',
					data: param
				}).then(response => {
					this.fullscreenLoading = false;
					if (response.data.code === 100) {
						this.getApplyShopList(1)
					} else {
						this.$message.error(response.data.message);
					}
				}).catch(error => {
					this.fullscreenLoading = false;
					console.log(error);
					this.$message.error('服务器出错!');
				})
			},
			handleCurrentChange(val){
				
			}
		}
	})
})
